/* ─── Variables ─────────────────────────────────────────── */
:root {
    --green:         #74c460;
    --blue:          rgba(20, 79, 206, 1);
    --blue2:         rgba(11, 64, 177, 1);
    --blue-glow:     rgba(20, 79, 206, 0.25);
    --white:         #fff;
    --gray:          #f5f5f5;
    --gray2:         #ececec;
    --black1:        #222;
    --black2:        #999;
    --shadow:        0 4px 8px rgba(61,61,61,.2), 0 6px 20px rgba(0,0,0,.19);
    --shadow-card:   0 8px 32px rgba(20,79,206,.10), 0 2px 8px rgba(0,0,0,.12);
    --border-radius: 10px;
    --transition:    all 0.3s ease;
}

/* ─── Reset ─────────────────────────────────────────────── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
    font-family: 'Roboto', sans-serif;
}

/* ─── Body / Fondo ──────────────────────────────────────── */
body {
    background-image: url('../imgs/fondo.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Overlay oscuro con gradiente */
body::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(0,0,0,.60) 0%,
        rgba(20,79,206,.25) 100%
    );
    z-index: 0;
}

/* Capa de transición de imágenes */
#bg-overlay {
    position: fixed;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1.2s ease;
    z-index: 0;
}

/* ─── Main ──────────────────────────────────────────────── */
main {
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ─── Contenedor ────────────────────────────────────────── */
.contenedor__todo {
    width: 100%;
    max-width: 400px;
    margin: auto;
    position: relative;
}

/* ─── Tarjeta del formulario ────────────────────────────── */
.formulario__login {
    width: 100%;
    padding: 44px 36px 36px;
    background: rgba(255,255,255,.97);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    border-top: 4px solid var(--blue);
    backdrop-filter: blur(6px);
    position: relative;
    overflow: hidden;
}

/* Brillo decorativo superior */
.formulario__login::after {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, var(--blue-glow) 0%, transparent 70%);
    pointer-events: none;
}

/* ─── Logo ──────────────────────────────────────────────── */
.logo1 {
    text-align: center;
    margin-bottom: 14px;
}

.logo1 img {
    width: 80px;        /* ← Aumentado de 60px a 100px */
    height: auto;
    filter: drop-shadow(0 2px 6px rgba(20,79,206,.18));
    transition: transform .4s ease;
}

.logo1 img:hover {
    transform: scale(1.07) rotate(-3deg);
}


/* ─── Título ────────────────────────────────────────────── */
h6 {
    text-align: center;
    margin-bottom: 12px;
    color: var(--black2);
    font-weight: 400;
    font-size: 13.5px;
    letter-spacing: .3px;
    line-height: 1.5;
}

/* ─── Separador decorativo ──────────────────────────────── */
.divider {
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, var(--blue), var(--green));
    border-radius: 99px;
    margin: 0 auto 28px;
}

/* ─── Grupos de campo ───────────────────────────────────── */
.form-group {
    margin-bottom: 22px;
    position: relative;
}

label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--black2);
    margin-bottom: 8px;
    transition: color .2s;
}

label i {
    font-size: 12px;
    color: var(--blue);
}

/* Label activo cuando el input tiene foco */
.form-group:focus-within label {
    color: var(--blue);
}

/* ─── Inputs ────────────────────────────────────────────── */
input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    background: var(--gray);
    font-size: 15px;
    outline: none;
    border-radius: var(--border-radius);
    transition: var(--transition);
    color: var(--black1);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
    color: #bbb;
    font-size: 14px;
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: var(--blue);
    background: #fff;
    box-shadow: 0 0 0 4px var(--blue-glow);
}

/* ─── Contenedor contraseña ─────────────────────────────── */
.password-container {
    display: flex;
    align-items: stretch;   /* ← Cambiado de center a stretch */
}

#contrasena {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
    margin: 0;             /* ← Asegura que no haya margen extra */
}

#show_password {
    display: flex;          /* ← Flex para centrar el icono */
    align-items: center;    /* ← Centra verticalmente el icono */
    justify-content: center;/* ← Centra horizontalmente el icono */
    padding: 0 16px;        /* ← Solo padding horizontal */
    background: var(--blue);
    color: var(--white);
    border: 2px solid var(--blue);   /* ← Borde igual al input */
    border-left: none;               /* ← Sin borde izquierdo */
    border-top-right-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 15px;
    line-height: 1;
    min-width: 46px;        /* ← Ancho mínimo consistente */
}

#show_password:hover {
    background: var(--blue2);
    border-color: var(--blue2);
}

/* Cuando el input de contraseña tiene foco,
   también resalta el botón de mostrar */
.password-container:focus-within #show_password {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px var(--blue-glow);
    /* Solo sombra en los lados derecho, arriba y abajo */
    clip-path: inset(-4px -4px -4px 0px);
}

/* ─── Botón Entrar ──────────────────────────────────────── */
#enter {
    width: 100%;
    padding: 13px;
    margin-top: 28px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .5px;
    cursor: pointer;
    color: var(--white);
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue2) 100%);
    box-shadow: 0 4px 14px rgba(20,79,206,.35);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

/* Efecto hover interior */
#enter::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.08);
    opacity: 0;
    transition: opacity .3s;
}

#enter:hover::before {
    opacity: 1;
}

#enter:hover {
    background: linear-gradient(135deg, var(--blue2) 0%, rgba(8,50,150,1) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(20,79,206,.45);
}

#enter:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(20,79,206,.3);
}

#enter.loading {
    pointer-events: none;
    opacity: .8;
}

/* ─── Enlace contraseña olvidada ────────────────────────── */
.con_olvidada {
    text-align: center;
    margin-top: 20px;
}

.con_olvidada a {
    color: var(--black2);
    font-size: 13px;
    transition: var(--transition);
    font-weight: 400;
}

.con_olvidada a:hover {
    color: var(--blue);
    text-decoration: underline;
}

/* ─── Mensaje de error ──────────────────────────────────── */
.error-message {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff5f5;
    border: 1px solid #fcc;
    border-left: 4px solid #e53e3e;
    border-radius: var(--border-radius);
    color: #c33;
    padding: 10px 14px;
    margin-bottom: 20px;
    font-size: 13.5px;
    animation: fadeIn 0.4s ease;
}

.error-message i {
    font-size: 16px;
    flex-shrink: 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Timeline ──────────────────────────────────────────── */
.timeline-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: rgba(255,255,255,.2);
    overflow: hidden;
    z-index: 10;
}

.timeline {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--green));
    animation: progress 5s linear infinite;
}

@keyframes progress {
    0%   { width: 0%; }
    100% { width: 100%; }
}

/* ─── Responsive 768px ──────────────────────────────────── */
@media (max-width: 768px) {
    .contenedor__todo {
        max-width: 90%;
        padding: 0 15px;
    }

    .formulario__login {
        padding: 30px 20px;
    }

    h6 {
        font-size: 13px;
    }

    input[type="text"],
    input[type="password"] {
        font-size: 14px;
    }

    #enter {
        font-size: 14px;
    }
}

/* ─── Responsive 480px ──────────────────────────────────── */
@media (max-width: 480px) {
    main {
        padding: 10px;
    }

    .formulario__login {
        padding: 25px 15px;
        border-radius: 12px;
    }

    .logo1 img {
        width: 50px;
    }

    h6 {
        font-size: 12px;
    }
}